#include "mapcontroller.h"

#include "maps.h"

using namespace fortress;

mapController::mapController()
{

}

mapController::~mapController()
{
	// delete everything from the vector
	for (std::vector<map*>::iterator it = gameMaps.begin(); it != gameMaps.end(); it++)
	{
		delete *it;
	}
}

portal * mapController::generateMap(portal * fromPortal)
{
	map * temp = new map(fromPortal, this);
	gameMaps.push_back(temp);
	return temp->getUpstairPortal();
}

portal * mapController::firstMap()
{
	map * temp = new map(this);
	gameMaps.push_back(temp);
	return temp->getUpstairPortal();
}

map & mapController::getMap(int mapId) const
{
	return *gameMaps.at(mapId);
}

void mapController::loadData()
{
	for (std::vector<map*>::iterator it = gameMaps.begin(); it != gameMaps.end(); it++)
	{
		(*it)->load();
	}
}